import type { App } from 'vue';

// 基础组件
export { default as BaseButton } from './BaseButton.vue';
export { default as CheckboxInput } from './CheckboxInput.vue';
export { default as MoneyInput } from './MoneyInput.vue';
export { default as RadioInput } from './RadioInput.vue';
export { default as SelectInput } from './SelectInput.vue';
export { default as SwitchInput } from './SwitchInput.vue';
export { default as TextInput } from './TextInput.vue';

// 预设按钮组件
export { default as DangerButton } from './DangerButton.vue';
export { default as GhostButton } from './GhostButton.vue';
export { default as OutlineButton } from './OutlineButton.vue';
export { default as PrimaryButton } from './PrimaryButton.vue';
export { default as SecondaryButton } from './SecondaryButton.vue';

// 类型导出
export type {
  BaseButtonProps,
  CommonButtonProps,
  DangerButtonProps,
  GhostButtonProps,
  OutlineButtonProps,
  PrimaryButtonProps,
  SecondaryButtonProps,
  SelectInputProps,
  SelectOption
} from './types';

// 导入所有组件用于插件注册
import BaseButton from './BaseButton.vue';
import CheckboxInput from './CheckboxInput.vue';
import DangerButton from './DangerButton.vue';
import GhostButton from './GhostButton.vue';
import MoneyInput from './MoneyInput.vue';
import OutlineButton from './OutlineButton.vue';
import PrimaryButton from './PrimaryButton.vue';
import RadioInput from './RadioInput.vue';
import SecondaryButton from './SecondaryButton.vue';
import SelectInput from './SelectInput.vue';
import SwitchInput from './SwitchInput.vue';
import TextInput from './TextInput.vue';

// 所有Form组件列表
const components = [
  BaseButton,
  CheckboxInput,
  MoneyInput,
  RadioInput,
  SelectInput,
  SwitchInput,
  TextInput,
  DangerButton,
  GhostButton,
  OutlineButton,
  PrimaryButton,
  SecondaryButton
];

// Vue插件安装函数
const install = (app: App) => {
  components.forEach((component) => {
    const componentName = component.name || component.__name;
    if (componentName) {
      app.component(componentName, component);
    }
  });
};

// 默认导出插件
export default {
  install
};
